package com.bsp.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bsp.domain.City;
import com.bsp.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by zyf
 */
@RestController
@RequestMapping(value = "city")
public class CityRestController {
    private static Logger logger= LoggerFactory.getLogger(CityRestController.class);

    @Autowired
    private CityService cityService;

    @RequestMapping(value = "/api/city", method = RequestMethod.GET)
    public City findOneCity(@RequestParam(value = "cityName", required = true) String cityName) {
        logger.info("--------方法执行--------------");
        return cityService.findCityByName(cityName);
    }
}
